package zmcc.bsp.fabric.config;

import org.hyperledger.fabric.gateway.Gateway;
import org.hyperledger.fabric.gateway.impl.GatewayImpl;

/**
 * The configuration properties of the {@link Gateway}.
 * 
 * @author ecsoya
 *
 */
public class FabricGatewayProperties {

	/**
	 * The timeout of committing to fabric, the unit is minutes.
	 * 
	 * The default value of fabric gateway is 5 minutes, here I increased it to 10
	 * minutes.
	 * 
	 * @see GatewayImpl
	 */
	private long commitTimeout = 10;

	/**
	 * @since 1.0.6
	 */
	private long ordererTimeout = 60; // seconds

	/**
	 * @since 1.0.6
	 */
	private long proposalTimeout = 5; // seconds

	/**
	 * Discovery of gateway builder.
	 * 
	 * @see GatewayImpl
	 */
	private boolean discovery = false;

	/**
	 * The commitHandler class name
	 * 
	 * @see GatewayImpl
	 */
	private String commitHandler;

	/**
	 * The queryHandler class name.
	 * 
	 * @see GatewayImpl
	 */
	private String queryHandler;

	/**
	 * The wallet configuration of gateway.
	 * 
	 * @see GatewayImpl
	 */
	private FabricWalletProperties wallet = new FabricWalletProperties();

	public FabricWalletProperties getWallet() {
		// TODO Auto-generated method stub
		return wallet;
	}

	public long getCommitTimeout() {
		// TODO Auto-generated method stub
		return commitTimeout;
	}

	public boolean isDiscovery() {
		// TODO Auto-generated method stub
		return discovery;
	}

	public long getOrdererTimeout() {
		// TODO Auto-generated method stub
		return ordererTimeout;
	}

	public long getProposalTimeout() {
		// TODO Auto-generated method stub
		return proposalTimeout;
	}
	
	public void  setWallet(FabricWalletProperties wallet) {
		// TODO Auto-generated method stub
		this.wallet = wallet;
	}

	public void setCommitTimeout(long commitTimeout) {
		// TODO Auto-generated method stub
		this.commitTimeout = commitTimeout;
	}

	public void setDiscovery(boolean discovery) {
		// TODO Auto-generated method stub
		this.discovery = discovery;
	}

	public void setOrdererTimeout(long ordererTimeout) {
		// TODO Auto-generated method stub
		this.ordererTimeout = ordererTimeout;
	}

	public void setProposalTimeout(long proposalTimeout) {
		// TODO Auto-generated method stub
		this.proposalTimeout = proposalTimeout;
	}

}
